#include <cstdlib>
#include <cstdio>

struct LNode
{
	int data;
	LNode*next;
};


void insertData(int e,LNode*&head)
{
	LNode*new_node = (LNode*)malloc(sizeof(LNode));
	new_node->data = e;
	new_node->next = nullptr;

	if (head == nullptr)
	{
		head = new_node;
	}
	else 
	{
		LNode*temp = head;
		while (temp->next != nullptr)
		{
			temp = temp->next;
		}
		temp->next = new_node;
	}
}


void test()
{
	LNode *head;
	// Inserting testing data
	insertData(10,head);
	insertData(20,head);
	insertData(30,head);

	LNode*temp = head;
	while (temp)
	{
		printf("%d\n",temp->data);
		temp = temp->next;
	}
	
}

int main()
{
	test();
	return 0;
}